inspector: Avoid a crash with GL variants
authorMatthias Clasen <mclasen@redhat.com>
Tue, 11 May 2021 01:25:08 +0000 (21:25 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 11 May 2021 01:25:08 +0000 (21:25 -0400)
When configuring the inspector display, preserve
debug flags that affect which GL variant we pick.
Otherwise, we may end up with a GLX context on the
default display, and an EGL context on the inspector
one. This hopelessly confuses libepoxy, and things
don't go well when that happens.

gtk/inspector/window.c

index 1b4560e08e0e15c021258989e6496215ab678c5c..02b108d8820f754a3a6786a372303fe0f01f5a77 100644 (file)
@@ -697,13 +697,16 @@ get_inspector_display (void)
   if (display)
     {
       const char *name;
+      GdkDebugFlags flags;
 
       name = g_getenv ("GTK_INSPECTOR_RENDERER");
 
       g_object_set_data_full (G_OBJECT (display), "gsk-renderer",
                               g_strdup (name), g_free);
 
-      gdk_display_set_debug_flags (display, 0);
+      flags = gdk_display_get_debug_flags (gdk_display_get_default ());
+
+      gdk_display_set_debug_flags (display, flags & (GDK_DEBUG_GL_GLES | GDK_DEBUG_GL_GLX));
       gtk_set_display_debug_flags (display, 0);
     }